package com.egao.common.publicly;

import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.web.JsonResult;
import com.egao.common.publicly.service.PubliclyCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页栏目集合
 * @author pyx
 */
@Api(tags = "栏目")
@RestController
@RequestMapping("${api}")
public class PubliclyCategoryController {
    @Autowired
    private PubliclyCategoryService publiclyCategoryService;

    @ApiOperation("查询文章类型栏目")
    @GetMapping("/publicly/category/tree")
    public JsonResult tree(){
        return JsonResult.ok().setData(publiclyCategoryService.tree());
    }

    @ApiOperation("查询首页导航栏目")
    @GetMapping("/publicly/category/head")
    public JsonResult headCategory(){
        return JsonResult.ok().setData(publiclyCategoryService.headCategory());
    }

    @ApiOperation("查询文章所属栏目")
    @GetMapping("/publicly/category/children")
    public JsonResult childrenList() {
        return JsonResult.ok().setData(publiclyCategoryService.childrenList());
    }
}
